LL_PKA_Init and LL_PKA_DeInit APIs migration ¶
The LL initialization and de-initialization functions previously available in the
stm32tnxx_ll_pka.c
files
within HAL1 are no longer present in HAL2.
In HAL2, all LL C files (
stm32tnxx_ll_pka.c) have been removed, leaving only the LL header files (
stm32tnxx_ll_pka.h)
that contain static inline functions.
If users need to initialize or de-initialize PKA using the LL layer, they have two methods:
Utilize STM32CubeMX2 Code Generation: Rely on STM32CubeMX2 to generate code with the LL layer for PKA initialization and de-initialization.
- Replace manually the initialization and de-initialization functionsReplace the
LL_PKA_InitandLL_PKA_DeInitfunctions manually with equivalent sequences using the static inline functions provided in the
stm32tnxx_ll_pka.hfile, tailored to their specific configuration and requirements.
- Replace manually the initialization and de-initialization functionsReplace the
This approach ensures that the initialization and de-initialization sequences are precisely addressing the given use case based on the LL static inline functions provided in the
stm32tnxx_ll_pka.h
header file.
The sequences offer improved footprint optimization compared to the previous LL initialization functions found in
stm32tnxx_ll_pka.c.
Related concept: Remove stm32tnxx_ll_ppp.c files
Method 1: Utilize STM32CubeMX2 Code Generation ¶
LL PKA configuration panel ¶
Create a new project with the STM32CubeMX2, then start the initialization.
Choose the LL layer for code generation.
LL NVIC configuration ¶
Configure the NVIC in case of an interrupt.
Generated PKA initialization sequence ¶
The PKA initialization sequences is generated in the
mx_pka_init
functions in
mx_pka.c
file under
$YOUR_PROJECT_NAME$/$YOUR_PROJECT_NAME$_SW/generated/STM32Cube_CodeGen.
|
Topic |
Code Snippet HAL1 |
Code Snippet HAL2 |
|---|---|---|
|
Init and config sequence function |
static void MX_PKA_Init(void)
{
/* Peripheral clock enable */
LL_AHB2_GRP1_EnableClock(LL_AHB2_GRP1_PERIPH_PKA);
/* PKA interrupt Init */
NVIC_SetPriority(PKA_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(),0, 0));
NVIC_EnableIRQ(PKA_IRQn);
LL_PKA_Enable(PKA);
}
|
PKA_TypeDef *mx_pka_init(void)
{
LL_AHB2_GRP1_EnableClock(LL_AHB2_GRP1_PERIPH_RNG);
LL_AHB2_GRP1_EnableClock(LL_AHB2_GRP1_PERIPH_PKA);
LL_AHB2_GRP1_EnableClock(LL_AHB2_GRP1_PERIPH_RNG);
LL_RCC_SetCK48ClockSource(LL_RCC_CK48_CLKSOURCE_HSIDIV3);
/* Enable the interruption for RNG */
NVIC_SetPriority(PKA_IRQn, NVIC_EncodePriority(NVIC_GetPriorityGrouping(), 0, 0));
NVIC_EnableIRQ(PKA_IRQn);
return PKA;
}
|
Method 2: Replace manually the initialization and de-initialization functions ¶
LL_PKA_Init() API migration ¶
According to the use-case, implement the precise sequence call based on the LL static inline functions provided in
the
stm32tnxx_ll_pka.h
header file.
|
HAL1 |
HAL2 |
|---|---|
LL_PKA_InitTypeDef pka_InitStruct;
pka_InitStruct.Mode = LL_PKA_MODE_MODULAR_EXP;
LL_PKA_Init(PKA, &pka_InitStruct);
|
LL_PKA_SetMode(PKA, LL_PKA_MODE_MODULAR_EXP);
|
LL_PKA_DeInit() API migration ¶
According to the used PKA, Implement the precise calls to
LL_AHB2_GRP1_ForceReset()
and
LL_AHB2_GRP1_ReleaseReset()
|
HAL1 |
HAL2 |
|---|---|
LL_PKA_DeInit(PKA)
|
LL_AHB2_GRP1_ForceReset(LL_AHB2_GRP1_PERIPH_PKA);
LL_AHB2_GRP1_ReleaseReset(LL_AHB2_GRP1_PERIPH_PKA);
|